home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / flex_247.zip / flex_247 / MISC / Think-C / THINK_C_notes < prev    next >
Text File  |  1992-01-28  |  4KB  |  82 lines

  1. Notes on the THINK C version of Flex 2.3.7
  2. Jonas Barklund, 25-JAN-92
  3. Internet: jonas@csd.uu.se
  4.  
  5. I have merged the sources for Flex version 2.3.7 with the older version
  6. which was hacked for THINK C version 4. I have conditionalized the code
  7. so that I think it should work with both THINK C version 4 and 5 (for
  8. those of you who don't know: the THINK_C symbol is defined as 1 in version
  9. 4 and as 5 in version 5). I have put in some missing prototypes, so it
  10. compiles also with "require prototypes" on.
  11.  
  12. Most of the notes below still apply, in particular that about the MakeRes
  13. program.
  14.  
  15.  
  16. Notes on the THINK C version of Flex
  17. Russell S. Finn, 19-FEB-90
  18. Internet: rsfinn@athena.mit.edu, rsfinn@neutron.lcs.mit.edu
  19. CompuServe: 76377,1107
  20. GEnie: RSFINN
  21.  
  22. Flex appears to be covered by a copyright notice from the University of
  23. California, similar to the one covering Berkeley Unix; the Free Software
  24. Foundation is not part of the picture here.  So here is a version
  25. created with THINK C 4.0, along with the source code; as with the
  26. Bison distribution, I am including *all* of the source code I received
  27. with the package.
  28.  
  29. The current version (modification date January 25, 1990) has only the
  30. bare-bones interface provided by the THINK C library routine "ccommand",
  31. which allows the user to type a command line and to redirect the output.
  32. Perhaps someday I may try to implement a "real" user interface; perhaps
  33. not.
  34.  
  35. The only modifications made to the source file are surrounded by "#ifdef
  36. THINK_C"..."#endif"; in theory, then, these sources could be recompiled
  37. on another system if necessary.  These are the actual files modified:
  38. alloca.c, dfa.c, flexdef.h, main.c, misc.c, scan.c, sym.c.  Most of these
  39. changes were minor, and many of them would have been unnecessary if the
  40. original Flex source code had been written for an ANSI-compliant C compiler.
  41. In addition, the file "macutils.c" is completely new; see the discussion
  42. of "MakeRes" below.
  43.  
  44. THINK C users may find it convenient to have the output text files written
  45. by Flex be THINK C documents.  To do this, create a copy of the "ANSI"
  46. project called "ANSI-KAHL", and a copy of the file "fopen.c" called
  47. "fopen-KAHL.c".  In the copy, find the routine "setfiletype", and replace
  48. the lines:
  49.     if (!(oflag & F_BINARY))
  50.         pb.ioFlFndrInfo.fdType = 'TEXT';
  51. with the lines:
  52.     if (!(oflag & F_BINARY)) {
  53.         pb.ioFlFndrInfo.fdType = 'TEXT';
  54.         pb.ioFlFndrInfo.fdCreator = 'KAHL';
  55.         }
  56. Replace "fopen.c" with the new "fopen-KAHL.c", rebuild the new project
  57. "ANSI-KAHL", and use this project in the project file "Flex.╣"
  58. instead of the "ANSI" project.
  59.  
  60. ** The "MakeRes" program
  61.  
  62. The output files created by Flex contain large amounts of preinitialized
  63. static data; the file "scan.c" contained in the Flex.╣ project is one
  64. such file.  However, the Macintosh architecture limits normal applications
  65. to 32K of global data.  In many cases (including Flex), this limit can
  66. be surpassed by the static data generated by Flex.
  67.  
  68. The solution I have implemented for the THINK C version of Flex is to
  69. extract the data tables from the Flex output file, and paste them into
  70. the file "MakeRes.c".  Then, by recompiling and running the program in
  71. the "MakeRes.╣" project (it is not necessary to create an application),
  72. a resource file called "Flex.╣.rsrc" is created in the current directory.
  73. The Flex output file "scan.c" has been modified to load the static data
  74. from the resource fork of the Flex application.  This is done by calling
  75. the "load_table" function, which is defined in the file "macutils.c".
  76.  
  77. In the application for which I needed Flex, the data tables were small
  78. enough that I didn't need to do this.  However, if your application
  79. requires you to do this, simply follow the model of "scan.c"; the MakeRes
  80. project and source code has been included for your use.
  81.  
  82.